<%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2022/1/18
  Time: 14:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="common/head.jsp"%>
<SCRIPT src="/static/js/jquery-3.4.1.js"></SCRIPT>
<script type="text/javascript">
    function update() {
        var updateForm = $("#updateForm").serializeArray();
        $.ajax({
            url: "../user/update",
            data: updateForm,
            type: "post",
            dataType: "json",
            success: function (data) {
                if (data==true) {
                    alert("修改成功");
                    location.href="page/logout";
                } else {
                    alert("修改失败");
                    location.href="page/update";
                }
            }
        })
        return false;
    }
</script>
<html>
<head>
    <title>修改用户密码</title>
</head>
<style>
    table,form{
        margin-left: auto;
        margin-right: auto;
        margin-top: 50px;
    }
    td{
        text-align: center;
        height: 40px;
        width: 200px;
    }
    input[type="submit"],input[type="reset"]{
        font-size: 10px;
        margin-top: 5px;
        width: 100px;
        height: 25px;
    }
    .td2{
        text-align: left;
        width: 400px;
    }


</style>
<body>
<%--240,248,255--%>
<form id="updateForm" onsubmit="return update()" name="updateForm" >
    <table style="background-color: #f0f8ff;" border="1px solid red" cellspacing="0px"  >
        <caption><h2>修改用户密码</h2></caption>
        <tr>
            <td class="td1">用户名:</td>
            <td class="td2" colspan="2" align="left"><input type="text" size="30" name="username" value="${userSession.username}" disabled></td>
        </tr>
        <tr>
            <td class="td1">密码:</td>
            <td class="td2" colspan="2" align="left"><input type="text" name="password" size="30"></td>
        </tr>
        <tr>
            <td colspan="3" class="td3">
                <div align="center">
                <input type="submit" value="修改">
                <input type="reset" value="重置">
                </div>
            </td>
        </tr>
    </table>
</form>
<%@include file="common/foot.jsp" %>
</body>
</html>
